﻿
<?php
 // print_r($_POST);die;
       if($_POST['type']==1){
        $data = !empty($_POST['checked'])?$_POST['checked']:$_GET['id'];

          $_rows=del('news',$data);
 // print_r($_rows);die;
           if($_rows>0){
          echo '<script>alert("批量删除成功");location.href="index.php?c=news&a=list&admin=1"; </script>';
            }else{
             echo '<script>alert("批量删除失败");history.go(-1) </script>';
         }

}

     if($_POST['type']==2){
     // print_r($_POST);die;
     $id=$_POST['checked'];

      $id = implode(',',$id);

     $status=$_POST['status'];

    // $status = implode(',',$status);
    // print_r($id);die;

     $sql= "update `news` set `auditing`='1' where id in($id)";
      //执行语句
    mysqli_query($link,$sql);
      //获取刚刚执行修改语句受影响的行数
    echo $xf=mysqli_affected_rows($link);

      if($xf>0){
          echo '<script>alert("批量审核成功");location.href="index.php?c=news&a=list&admin=1"; </script>';
            }else{
             echo '<script>alert("批量审核失败");history.go(-1) </script>';
         }

     }


     if($_POST['type']==3){
     // print_r($_POST);die;
     $id=$_POST['checked'];

      $id = implode(',',$id);

     $status=$_POST['status'];

    // $status = implode(',',$status);
    // print_r($id);die;

     $sql= "update `news` set `auditing`='0' where id in($id)";
      //执行语句
    mysqli_query($link,$sql);
      //获取刚刚执行修改语句受影响的行数
    echo $xf=mysqli_affected_rows($link);

      if($xf>0){
          echo '<script>alert("批量审核成功");location.href="index.php?c=news&a=list&admin=1"; </script>';
            }else{
             echo '<script>alert("批量审核失败");history.go(-1) </script>';
         }

     }


?>